import threadpool


def func(i):
    min = i * 10 + 1
    max = (i + 1) * 10
    sum = 0
    for v in range(min, max + 1):
        sum += v
    return sum


results = []


def work_callback(work, sum):
    results.append(sum)


pool = threadpool.ThreadPool(10)
for i in range(10):
    work = threadpool.WorkRequest(callable_=func, args=(i,),
                                  callback=work_callback)
    pool.putRequest(request=work)
pool.wait()

s_sum = 0
for i in results:
    s_sum += int(i)
print(s_sum)
